# 导入StirctRedis类
from redis import StrictRedis


class Config:
    DEBUG = True

    # 配置数据库参数
    SQLALCHEMY_DATABASE_URI = 'mysql://root:mysql@localhost/info'
    SQLALCHEMY_TRACK_MODIFICATIONS = False
    SECRET_KEY = b'40QmDumNHAsWBLIEqDW1dFC7beQqKJZlBUUXGzXYv+A='

    # 配置Session参数
    # 配合状态保持存储session信息
    SESSION_TYPE = 'redis'
    # 定义redis 主机和端口号
    REDIS_HOST = '127.0.0.1'
    REDIS_PORT = 6379
    # 设置session签名
    SESSION_USE_SIGNER = True
    # 构造redis实例?????/
    SESSION_REDIS = StrictRedis(host=REDIS_HOST, port=REDIS_PORT)
    # 设置session过期时间
    PERMANENT_SESSION_LIFETIME = 86400


class DevelopmentConfig(Config):
    DEBUG = True


class ProductionConfig(Config):
    DEBUG = False


config = {
    'development': DevelopmentConfig,
    'production': ProductionConfig
}
